package com.sunxd.zstudy.java8.lambda;

import java.util.function.Function;

/**
 * @author sun.xd
 * @description: description
 * @date 2023/11/14 17:57
 */
public class TFunction {
    public static void main(String[] args) {
        // 匿名内部类的实现
        Function<String,String> function1 = new Function<String,String>(){
            @Override
            public String apply(String s) {
                return s + s;
            }
        };
        String abc = function1.apply("abc");
        System.out.println(abc);

        Function<String,String> function2 = (x) -> {
            return x + x;
        };
        abc = function2.apply("abc");
        System.out.println(abc);

        Function<String ,String > function3 = (x) -> x + x;
        abc = function3.apply("abc");
        System.out.println(abc);
    }
}
